package com.shared_file_bucket.common.exception;

import lombok.NoArgsConstructor;

/**
 * 自定义全局异常
 */
@NoArgsConstructor
public class GlobalException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private ErrorCode errorCode = CommonErrorCode.UNKNOWN_ERROR;

    private Object[] errArgs;


    public GlobalException(ErrorCode errCode, Object... errArgs) {
        super(errCode.value());
        this.errorCode = errCode;
        this.errArgs = errArgs;
    }

    public GlobalException(String message) {
        super(message);
    }

    public ErrorCode getErrorCode() {
        return this.errorCode;
    }

    public Object[] getErrArgs() {
        return this.errArgs;
    }
}